<!-- 多台开席的弹窗组件 -->
<!-- 多台开席调整也是使用这个组件 -->
<template>
  <div>
    <CustomDialog
      v-model:visible="isShowDialog"
      :top="isShowDesktopType ? '15vh' : '2vh'"
      curentClass="mulOpeningDesktopDialog-box"
    >
      <div class="dialog-content" v-if="isShowDesktopType">
        <div class="title">选择开台方式</div>
        <div class="btn-box">
          <div class="cancel-btn" @click="handleConfirm(10)">酒席方式</div>
          <div class="confirm-btn" @click="handleConfirm(20)">散点方式</div>
        </div>
      </div>
      <div class="mulOpeningDesktopDialog-box" v-else>
        <div class="left-box">
          <div class="title">{{ actionType === 'mulOpening' ? '多台开席' : '多台开席调整' }}</div>
          <div class="paging-list-box">
            <div
              class="paging-list-item"
              :class="{ 'paging-list-item-active': pagingActiveIndex === pagingIndex }"
              @click="handleSelectPaging(pagingIndex, pagingItem)"
              v-for="(pagingItem, pagingIndex) in desktopCategoryList"
              :key="pagingItem.id + pagingItem.name + pagingIndex"
            >
              <el-tooltip class="item" effect="dark" :content="pagingItem.name" placement="top">
                <div class="name">{{ pagingItem.name }}</div>
              </el-tooltip>
            </div>
            <div class="paging-list-btn">
              <img
                class="left-btn"
                @click.stop="oneCatePreviousPage"
                src="@/assets/images/home/page-left-icon.png"
                alt=""
              />
              <img
                @click.stop="oneCateNextPage"
                class="right-btn"
                src="@/assets/images/home/page-right-icon.png"
                alt=""
              />
            </div>
          </div>

          <div class="room-content-box" v-loading="listLoading">
            <div class="room-scroll-list" v-if="!isEmptyDesktopIdleList">
              <div
                class="scroll-list-item"
                v-for="(desk, index) in desktopIdleList"
                :key="desk.id + index"
                @click="handleSelectTable(index, desk)"
                :style="{
                  'border-color': desk.isChecked ? '#7c0a03' : '#aa535c'
                }"
              >
                <div
                  class="title-box"
                  :style="{
                    background: desk.isChecked ? '#7c0a03' : '#aa535c'
                  }"
                >
                  <div class="name">{{ desk.is_use.text }}</div>
                  <div class="count">
                    <span>{{ desk.use_num || '0' }}</span
                    >/<span>{{ desk.capacity }}人</span>
                  </div>
                </div>
                <div class="desc-box">
                  <div class="numberAndTag">
                    <el-tooltip class="item" effect="dark" :content="desk.name" placement="top">
                      <div class="number">{{ desk.name }}</div>
                    </el-tooltip>
                    <div class="tag" v-if="desk.recordInfo && desk.recordInfo.recordType">
                      {{ desk.recordInfo.recordType }}
                    </div>
                  </div>
                </div>
                <!-- 选中桌台的图片 -->
                <img
                  v-show="desk.isChecked"
                  class="choose-img"
                  src="@/assets/images/home/xuanzhongzhuotai.png"
                  alt=""
                />
              </div>
            </div>

            <!-- 暂无数据的组件 -->
            <div class="no-data-box" v-if="isEmptyDesktopIdleList">
              <div class="desc">暂无桌台数据</div>
            </div>
          </div>
          <div class="count-choose-box" v-if="!isEmptyDesktopIdleList">
            <div class="total">共{{ desktopIdleListTotal }}台</div>
          </div>
        </div>
        <div class="right-box">
          <div class="title">开席桌台</div>
          <div class="desktop-form-box">
            <div class="room-selected-box">
              <div class="room-selected-scroll-list" v-if="selectedDesktopList.length">
                <div
                  class="scroll-selected-list-item"
                  v-for="(desk, index) in selectedDesktopList"
                  :key="desk.id + desk.name + index"
                  :style="{
                    'border-color': '#aa535c'
                  }"
                >
                  <div
                    class="title-box"
                    :style="{
                      background: '#aa535c'
                    }"
                  >
                    <div class="name">{{ desk.is_use.text }}</div>
                    <div class="count">
                      <span>{{ desk.use_num || '0' }}</span
                      >/<span>{{ desk.capacity }}人</span>
                    </div>
                  </div>
                  <div class="desc-box">
                    <div class="numberAndTag">
                      <el-tooltip class="item" effect="dark" :content="desk.name" placement="top">
                        <div class="number">{{ desk.name }}</div>
                      </el-tooltip>
                      <div class="tag" v-if="desk.recordInfo && desk.recordInfo.recordType">
                        {{ desk.recordInfo.recordType }}
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <!-- 暂无数据的组件 -->
              <div class="no-data-box-two" v-else>
                <div class="desc">暂无桌台数据</div>
              </div>
            </div>
            <div class="count-selected-box">
              <div class="total" v-if="selectedDesktopList.length">
                已选{{ selectedDesktopList.length }}台
              </div>
            </div>
            <!-- 表单区域 -->
            <div class="form-input-box">
              <div class="form-item">
                <div class="desc">人数</div>
                <div class="dialog-input">
                  <input
                    class="input"
                    v-model.trim="openPeopleNum"
                    type="number"
                    placeholder="请输入人数"
                    @focus="handleInputFocus('people')"
                    :min="1"
                  />
                  <img
                    class="image"
                    src="@/assets/images/home/input-clear.png"
                    alt=""
                    @click="onKeyboardClear()"
                    v-if="openPeopleNum"
                  />
                </div>
              </div>
              <div class="form-item" v-if="settleType === 10">
                <div class="desc">单席金额</div>
                <div class="dialog-input">
                  <input
                    class="input"
                    v-model.trim="openMoneyNum"
                    type="number"
                    placeholder="请输入单席金额"
                    @focus="handleInputFocus('money')"
                    :min="1"
                  />
                  <img
                    class="image"
                    src="@/assets/images/home/input-clear.png"
                    alt=""
                    @click="onKeyboardClear()"
                    v-if="openMoneyNum"
                  />
                </div>
              </div>
              <div class="form-item">
                <div class="desc">席数</div>
                <div class="dialog-input">
                  <input
                    class="input"
                    v-model.trim="openSeatNum"
                    type="number"
                    placeholder="请输入席数"
                    @focus="handleInputFocus('seat')"
                    :min="1"
                  />
                  <img
                    class="image"
                    src="@/assets/images/home/input-clear.png"
                    alt=""
                    @click="onKeyboardClear()"
                    v-if="openSeatNum"
                  />
                </div>
              </div>
            </div>

            <!-- 数字键盘组件 -->
            <div class="number-keyword-box">
              <!-- 数字键盘 -->
              <NumberKeyboard
                v-model:keyword="keyboardValue"
                :isFirstZero="false"
                :showRadixPoint="false"
                @onInputKeyboard="onKeyboardInput"
                @onCancel="onKeyboardClear"
                @onConfirm="confirmSelection"
                :loading="loading"
              />
            </div>
          </div>
        </div>
      </div>
    </CustomDialog>
  </div>
</template>

<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { isEmpty, throttle } from '@/utils/toolsValidate'
import { fetchCategoryList, fetchDeskList } from '@/api/desktop'
import CustomDialog from '@/components/CustomDialog/Index.vue'
import NumberKeyboard from '@/components/NumberKeyboard/Index.vue'
import { openMulDesk } from '@/api/food'
import { useRouter } from 'vue-router'
const router = useRouter()
// 弹框显示状态
const isShowDialog = ref(false)

// 是否显示开台方式选择
const isShowDesktopType = ref(true)

// 操作类型：mulOpening 或 adjust
const actionType = ref('mulOpening')

// 一级分类：分页专用索引
const pagingActiveIndex = ref(0)

// 桌台分类列表
const desktopCategoryList = ref([])

// 空闲桌台列表
const desktopIdleList = ref([])

// 已选桌台列表
const selectedDesktopList = ref([])

// 桌台分类列表分页相关
const deskCategoryPageQuery = ref({
  page: 1,
  limit: 4
})

// 判断一级分类是否还能继续下一页操作分页
const deskOneCategoryLastPage = ref(0)

// 空闲桌台总数
const desktopIdleListTotal = ref(0)

// 列表加载状态
const listLoading = ref(false)

// 右侧表单与键盘
const activeInput = ref<'people' | 'seat' | 'money' | ''>('')
const openPeopleNum = ref('')
const openSeatNum = ref('')
const openMoneyNum = ref('')
const keyboardValue = ref('')

// 加载状态
const loading = ref(false)

const handleInputFocus = (type: 'people' | 'seat' | 'money') => {
  activeInput.value = type
  if (type === 'people') keyboardValue.value = openPeopleNum.value
  else if (type === 'seat') keyboardValue.value = openSeatNum.value
  else if (type === 'money') keyboardValue.value = openMoneyNum.value
}

const onKeyboardInput = (val: string) => {
  keyboardValue.value = val
  if (activeInput.value === 'people') openPeopleNum.value = val
  if (activeInput.value === 'seat') openSeatNum.value = val
  if (activeInput.value === 'money') openMoneyNum.value = val
}
const onKeyboardClear = () => {
  keyboardValue.value = ''
  if (activeInput.value === 'people') openPeopleNum.value = ''
  if (activeInput.value === 'seat') openSeatNum.value = ''
  if (activeInput.value === 'money') openMoneyNum.value = ''
}

// 计算属性：是否为空闲桌台列表
const isEmptyDesktopIdleList = computed(() => {
  return isEmpty(desktopIdleList.value)
})

// 结算方式  10:酒席方式    20：散点方式
const settleType = ref(10)

// 监听弹框显示状态
watch(isShowDialog, val => {
  if (val) {
    // 弹框打开时重置状态
    isShowDesktopType.value = true
    selectedDesktopList.value = []
    openPeopleNum.value = ''
    openSeatNum.value = ''
    openMoneyNum.value = ''
    keyboardValue.value = ''
    // 获取桌台分类数据
    getDesktopCategoryList()
  }
})

// 处理关闭弹框
const handleClose = () => {
  isShowDialog.value = false
}

// 处理确认开台方式
const handleConfirm = (type: number) => {
  settleType.value = type
  isShowDesktopType.value = false
  // 根据类型设置操作类型
  if (type === 10) {
    actionType.value = 'mulOpening'
  } else {
    actionType.value = 'adjust'
  }
  // 获取空闲桌台列表
  listLoading.value = true // 设置加载状态
  getDesktopIdleList()
}

// 处理选择分页
const handleSelectPaging = (index: number, item: any) => {
  pagingActiveIndex.value = index
  // 根据分类获取空闲桌台
  listLoading.value = true // 设置加载状态
  getDesktopIdleList(item.id)
}

// 上一页分类
const oneCatePreviousPage = () => {
  if (deskCategoryPageQuery.value.page > 1) {
    deskCategoryPageQuery.value.page--
    getDesktopCategoryList()
  }
}

// 下一页分类
const oneCateNextPage = () => {
  if (deskCategoryPageQuery.value.page < deskOneCategoryLastPage.value) {
    deskCategoryPageQuery.value.page++
    getDesktopCategoryList()
  }
}

// 获取桌台分类数据（对接真实API）
const getDesktopCategoryList = async () => {
  try {
    // 设置加载状态
    listLoading.value = true

    const res = await fetchCategoryList({
      page: deskCategoryPageQuery.value.page,
      limit: deskCategoryPageQuery.value.limit
    })
    if (res?.status === 200) {
      const list = Array.isArray(res.data?.data) ? res.data.data : []
      const mappedList = list.map((c: any) => ({ id: c.id, name: c.name }))

      // 如果是第一页，添加"全部"选项
      if (deskCategoryPageQuery.value.page === 1) {
        mappedList.unshift({
          id: 0,
          name: '全部'
        })
      }

      desktopCategoryList.value = mappedList
      if (res.data?.total && res.data?.per_page) {
        deskOneCategoryLastPage.value = Math.ceil(res.data.total / res.data.per_page)
      } else {
        deskOneCategoryLastPage.value = 1
      }

      // 获取完分类后，获取桌台列表
      if (deskCategoryPageQuery.value.page === 1) {
        getDesktopIdleList(0) // 默认获取全部分类的桌台
      } else {
        listLoading.value = false // 如果不是第一页，直接结束加载状态
      }
    } else {
      desktopCategoryList.value = []
      deskOneCategoryLastPage.value = 0
      listLoading.value = false
    }
  } catch (error) {
    console.error('获取桌台分类失败:', error)
    desktopCategoryList.value = []
    deskOneCategoryLastPage.value = 0
    listLoading.value = false
  }
}

// 获取空闲桌台列表（对接真实API）
const getDesktopIdleList = async (categoryId?: number) => {
  try {
    // 设置加载状态
    listLoading.value = true

    const params: any = {
      is_use: 0,
      page: 1,
      limit: 100
    }
    if (categoryId) params.category_id = categoryId
    const res = await fetchDeskList(params)
    if (res?.status === 200) {
      const list = Array.isArray(res.data?.data)
        ? res.data.data
        : Array.isArray(res.data)
          ? res.data
          : []
      // 只取空闲桌台并规范字段，添加选中标记
      const mapped = list.map((d: any) => {
        // 检查是否已在选中列表中
        const isSelected = selectedDesktopList.value.some(item => item.id === d.id)
        return {
          id: d.id,
          name: d.name,
          capacity: d.capacity,
          is_use: d.is_use || { value: 0, text: '空闲' },
          use_num: d.use_num || 0,
          recordInfo: d.recordInfo,
          isChecked: isSelected
        }
      })
      desktopIdleList.value = mapped
      desktopIdleListTotal.value = res.data?.total ?? mapped.length
    } else {
      desktopIdleList.value = []
      desktopIdleListTotal.value = 0
    }
  } catch (error) {
    console.error('获取空闲桌台失败:', error)
    desktopIdleList.value = []
    desktopIdleListTotal.value = 0
  } finally {
    // 无论成功失败，都结束加载状态
    listLoading.value = false
  }
}

// 处理选择桌台
const handleSelectTable = (index: number, desk: any) => {
  // 切换选中状态
  desktopIdleList.value[index].isChecked = !desktopIdleList.value[index].isChecked

  if (desktopIdleList.value[index].isChecked) {
    // 添加到已选列表
    selectedDesktopList.value.push(desk)
  } else {
    // 从已选列表移除
    const removeIndex = selectedDesktopList.value.findIndex(item => item.id === desk.id)
    if (removeIndex > -1) {
      selectedDesktopList.value.splice(removeIndex, 1)
    }
  }
}

// 移除已选桌台
const removeSelectedDesktop = (index: number) => {
  const removedDesk = selectedDesktopList.value[index]
  selectedDesktopList.value.splice(index, 1)

  // 同步更新空闲桌台列表的选中状态
  const deskIndex = desktopIdleList.value.findIndex(item => item.id === removedDesk.id)
  if (deskIndex > -1) {
    desktopIdleList.value[deskIndex].isChecked = false
  }
}

// 同步席数与选中桌台数量
watch(
  selectedDesktopList,
  list => {
    openSeatNum.value = list.length ? String(list.length) : ''
  },
  { deep: true }
)

// 确认选择
const confirmSelection = throttle(async function () {
  // 表单验证
  if (selectedDesktopList.value.length === 0) {
    ElMessage.warning('请选择桌台')
    return
  }

  if (!openPeopleNum.value) {
    ElMessage.warning('请输入人数')
    return
  }

  if (!openSeatNum.value) {
    ElMessage.warning('请输入席数')
    return
  }

  // 酒席方式需要验证单席金额
  if (settleType.value === 10 && !openMoneyNum.value) {
    ElMessage.warning('请输入单席金额')
    return
  }

  // 席数只能大于等于桌台数
  if (Number(openSeatNum.value) < selectedDesktopList.value.length) {
    ElMessage.warning('席数只能大于等于桌台数')
    return
  }

  // TODO: 实现多台开席的逻辑
  const params: any = {
    use_num: openPeopleNum.value, // 使用人数
    settle_type: settleType.value, // 结算方式  10:酒席方式    20：散点方式
    open_num: openSeatNum.value, // 席数
    desk_ids: selectedDesktopList.value.map(item => item.id)
  }

  // 酒席方式需要添加单席金额
  if (settleType.value === 10) {
    params.money = openMoneyNum.value
  }
  console.log(selectedDesktopList)

  // console.log('多台开席参数:', params)
  loading.value = true
  try {
    const res = await openMulDesk(params)
    if (res?.status === 200) {
      ElMessage.success(res.message || '多台开席成功')
      emit('updateList')
      // 传输2是全席点菜 默认全席点菜
      router.push(`/home/diancai/${res.data.record_id}?type=2`)
      handleClose()
    }
  } catch (error) {
    console.error('多台开席失败:', error)
  } finally {
    loading.value = false
  }
  // router.push(`/home/diancai/${res.data.record_id}?type=2`)
}, 500)

// 暴露给父组件的方法
defineExpose({
  isShowDialog
})

// 定义props和emits
interface Props {
  modelValue: boolean
}

interface Emits {
  (e: 'update:modelValue', value: boolean): void
  (e: 'updateList'): void
}

const props = defineProps<Props>()
const emit = defineEmits<Emits>()

// 监听props变化，同步到本地状态
watch(
  () => props.modelValue,
  val => {
    isShowDialog.value = val
  }
)

// 监听本地状态变化，同步到父组件
watch(isShowDialog, val => {
  emit('update:modelValue', val)
})
</script>

<style lang="scss" scoped>
.dialog-content {
  .title {
    padding-left: 24px;
    padding-top: 7px;
    font-size: 18px;
    font-family:
      PingFang SC,
      PingFang SC-Bold;
    font-weight: 700;
    text-align: left;
    color: #333333;
    margin-bottom: 20px;
    text-align: center;
  }

  .select-box {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 50px;

    .el-select-box {
      width: 300px;
    }
  }

  .btn-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 50px;

    .cancel-btn {
      width: 190px;
      height: 60px;
      background: #ffffff;
      border: 1px solid #333333;
      border-radius: 12px;
      font-size: 18px;
      font-family:
        PingFang SC,
        PingFang SC-Regular;
      font-weight: 400;
      text-align: center;
      color: #333333;
      line-height: 60px;
      cursor: pointer;
    }

    .confirm-btn {
      width: 190px;
      height: 60px;
      background: #7c0a03;
      border-radius: 12px;
      font-size: 18px;
      font-family:
        PingFang SC,
        PingFang SC-Regular;
      font-weight: 400;
      text-align: center;
      color: #ffffff;
      line-height: 60px;
      cursor: pointer;
    }
  }
}

.mulOpeningDesktopDialog-box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  .left-box {
    width: 720px;
    box-sizing: border-box;

    .title {
      padding-left: 24px;
      padding-top: 7px;
      font-size: 18px;
      font-family:
        PingFang SC,
        PingFang SC-Bold;
      font-weight: 700;
      text-align: left;
      color: #333333;
      margin-bottom: 20px;
    }
    .paging-list-box {
      position: relative;
      box-sizing: border-box;
      width: 700px;
      height: 48px;
      background: #ffffff;
      border: 1px solid #d0d0d0;
      border-radius: 25px;
      display: flex;
      align-items: center;

      .paging-list-item {
        display: inline-block;
        padding: 0 30px;
        height: 48px;
        line-height: 48px;
        font-size: 16px;
        font-family:
          PingFang SC,
          PingFang SC-Regular;
        font-weight: 400;
        text-align: center;
        color: #333333;
        cursor: pointer;

        .name {
          max-width: 60px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }

      .paging-list-item-active {
        color: #ffffff;
        background: #7c0a03;
        border-radius: 24px;
      }

      .paging-list-btn {
        position: absolute;
        top: 12px;
        right: 16px;
        display: flex;
        align-items: center;

        .left-btn,
        .right-btn {
          flex-shrink: 0;
          width: 24px;
          height: 24px;
          cursor: pointer;
        }

        .left-btn {
          margin-right: 20px;
        }
      }
    }

    .room-content-box {
      padding: 0 24px 20px 24px;
      box-sizing: border-box;
      height: 690px;
      overflow-y: auto;
      background: #f4f4f4;
      margin-top: 30px;

      .room-scroll-list {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        justify-content: space-between;

        .scroll-list-item {
          position: relative;
          width: 215px;
          height: 210px;
          box-sizing: border-box;
          background: #ffffff;
          border: 1px solid #aa535c;
          border-top: none;
          border-radius: 12px;
          margin-top: 20px;
          cursor: pointer;
          transition: all 0.3s;

          .title-box {
            display: flex;
            align-items: center;
            justify-content: space-between;
            height: 44px;
            background: #aa535c;
            padding: 0 12px;
            font-size: 14px;
            font-family:
              PingFang SC,
              PingFang SC-Bold;
            font-weight: 700;
            color: #ffffff;
            border-radius: 12px 12px 0px 0px;

            .name {
              font-size: 14px;
              font-weight: bold;
            }
          }

          .desc-box {
            padding: 10px 0 0 12px;

            .numberAndTag {
              display: flex;
              align-items: flex-start;

              .number {
                max-width: 200px;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
                font-size: 36px;
                font-family:
                  PingFang SC,
                  PingFang SC-Bold;
                font-weight: 700;
                color: #434447;
              }

              .tag {
                display: inline-block;
                padding: 0 10px;
                height: 20px;
                line-height: 20px;
                background: #cba699;
                border-radius: 10px 10px 10px 0px;
                font-size: 14px;
                font-family:
                  PingFang SC,
                  PingFang SC-Bold;
                font-weight: 700;
                text-align: center;
                color: #ffffff;
                margin-left: 4px;
              }
            }
          }

          .choose-img {
            position: absolute;
            right: 12px;
            bottom: 12px;
            width: 24px;
            height: 24px;
          }
        }
      }

      .no-data-box {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 170px;
        margin-top: 250px;
      }
    }

    .count-choose-box {
      height: 60px;
      padding-left: 20px;
      box-sizing: border-box;
      background: #f4f4f4;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      font-size: 14px;
      font-family:
        PingFang SC,
        PingFang SC-Regular;
      font-weight: 400;
      color: #333333;
    }
  }

  .right-box {
    width: 590px;
    box-sizing: border-box;
    margin-left: 50px;

    .title {
      padding-left: 24px;
      padding-top: 7px;
      font-size: 18px;
      font-family:
        PingFang SC,
        PingFang SC-Bold;
      font-weight: 700;
      text-align: left;
      color: #333333;
      margin-bottom: 20px;
    }

    .opening-placeholder {
      width: 590px;
      height: 211px;
      box-sizing: border-box;
      background: #f4f4f4;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 12px 12px 0 0;

      .desc {
        font-size: 14px;
        color: #999;
      }
    }

    .form-box {
      padding: 20px 24px;

      .form-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;

        .label {
          font-size: 18px;
          font-family:
            PingFang SC,
            PingFang SC-Regular;
          font-weight: 400;
          color: #333333;
        }

        .el-input {
          width: 422px;
          height: 48px;

          :deep(.el-input__inner) {
            height: 48px;
            border-radius: 12px;
            border: 1px solid #d2d2d2;
          }
        }
      }
    }

    .keyboard-box {
      margin-top: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 330px;
      background: #ffffff;
      border-radius: 0px 0px 12px 12px;
      box-shadow: 0px -3px 6px 0px rgba(0, 0, 0, 0.04);
      box-sizing: border-box;
    }
  }
}
//滚动条整体的大小
.room-selected-box::-webkit-scrollbar {
  width: 6px !important;
  height: 0 !important;
}

//滚动条里滑动的滑块
.room-selected-box::-webkit-scrollbar-thumb {
  height: 200px !important;
  background: #d2d2d2 !important;
  border-radius: 3px !important;
}

//滚动条底层样式
.room-selected-box::-webkit-scrollbar-track {
  display: none !important;
}

//滚动条整体的大小
.room-content-box::-webkit-scrollbar {
  width: 6px !important;
  height: 0 !important;
}

//滚动条里滑动的滑块
.room-content-box::-webkit-scrollbar-thumb {
  height: 200px !important;
  background: #d2d2d2 !important;
  border-radius: 3px !important;
}

//滚动条底层样式
.room-content-box::-webkit-scrollbar-track {
  display: none !important;
}

.no-data-box-two {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 170px;
  margin-top: 20px;
}

.desktop-form-box {
  width: 590px;
  height: 834px;
  box-sizing: border-box;
  border: 1px solid #d2d2d2;
  border-radius: 12px;

  .room-selected-box {
    border-radius: 12px 12px 0 0;
    padding: 0 20px 20px 20px;
    box-sizing: border-box;
    height: 211px;
    overflow-y: auto;
    background: #f4f4f4;

    .room-selected-scroll-list {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      justify-content: space-between;

      .scroll-selected-list-item {
        position: relative;
        width: 167px;
        height: 161px;
        background: #fff;
        border: 1px solid #d2d2d2;
        border-radius: 12px;
        box-sizing: border-box;
        border-top: none;
        margin-top: 20px;
        cursor: pointer;

        .title-box {
          display: flex;
          align-items: center;
          justify-content: space-between;
          height: 35px;
          background: #d2d2d2;
          padding: 0 12px;
          font-size: 10px;
          font-family:
            PingFang SC,
            PingFang SC-Bold;
          font-weight: 700;
          color: #ffffff;
          border-radius: 12px 12px 0px 0px;
        }

        .desc-box {
          padding: 6px 0 0 8px;

          .numberAndTag {
            display: flex;
            align-items: flex-start;

            .number {
              max-width: 160px;
              white-space: nowrap;
              text-overflow: ellipsis;
              overflow: hidden;
              font-size: 25px;
              font-family:
                PingFang SC,
                PingFang SC-Bold;
              font-weight: 700;
              color: #434447;
            }

            .tag {
              display: inline-block;
              padding: 0 10px;
              height: 20px;
              line-height: 20px;
              background: #cba699;
              border-radius: 10px 10px 10px 0px;
              font-size: 14px;
              font-family:
                PingFang SC,
                PingFang SC-Bold;
              font-weight: 700;
              text-align: center;
              color: #ffffff;
              margin-left: 4px;
            }
          }
        }
      }
    }

    .room-selected-scroll-list::after {
      content: '';
      width: 167px;
    }
  }

  .count-selected-box {
    height: 62px;
    padding-left: 20px;
    box-sizing: border-box;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 16px;
    font-family:
      PingFang SC,
      PingFang SC-Regular;
    font-weight: 400;
    color: #333333;
  }

  .form-input-box {
    padding: 0 24px 20px 24px;

    .form-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 20px;

      .desc {
        font-size: 18px;
        font-family:
          PingFang SC,
          PingFang SC-Regular;
        font-weight: 400;
        color: #333333;
      }

      .dialog-input {
        width: 422px;
        height: 48px;
        background: #ffffff;
        border: 1px solid #d2d2d2;
        border-radius: 12px;
        box-sizing: border-box;
        padding: 0 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .input {
          width: 400px;
          font-size: 14px;
          font-family:
            PingFang SC,
            PingFang SC-Regular;
          font-weight: 400;
          text-align: left;
          color: #333333;
          outline: none;
          border: none;
        }

        .image {
          flex-shrink: 0;
          width: 24px;
          height: 24px;
          cursor: pointer;
        }
      }
    }
  }

  .number-keyword-box {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 330px;
    background: #ffffff;
    border-radius: 0px 0px 12px 12px;
    box-shadow: 0px -3px 6px 0px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
  }
}
</style>
<style>
.mulOpeningDesktopDialog-box {
  max-height: unset !important;
}
</style>
